package cate.game.play.buff.h;

import cate.game.play.base.HpCfg;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import easy.java.struct.ref.DoubleRef;

/**
 *   携带该状态的目标受击时免疫基于发起者300%灵能防御的伤害，并将免疫伤害以70%效率反馈给攻击者
 */
public class 壁垒BH extends BuffHandler {

	private HpCfg 血量配置;

	private double 反馈系数;

	//血量配置=？？&反馈系数=7000
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		血量配置 = new HpCfg(args);
		反馈系数 = args.getWDouble("反馈系数", 0d);
	}

	@Override
	public void adjustSkillDamage(ActionCtx action, Fighter actor, int reason, DoubleRef doubleRef) {
		double reduce = 血量配置.settle(actor, buff.owner);
		reduce = Math.min(reduce, doubleRef.v);
		doubleRef.v -= reduce;
		actor.attr.buffHurt(action, actor, reduce * 反馈系数);

	}
}
